<template>
  <div class="acctive">
     <el-form :model="formdata">
      <el-form-item>
          <el-select
            v-model="formdata.region"
            placeholder="请选择状态"
            style="width: 15%"
          >
            <el-option label="已同意" value="ToAccount"></el-option>
            <el-option label="已驳回" value="Reject"></el-option>
            <el-option label="未审核" value="WaitAudit"></el-option>
            <!-- <el-option label="待上核" value='null'></el-option> -->
          </el-select>
      <el-button class="chande" @click="search()">搜索</el-button>
      <el-button class="aceater" @click="replacement">重置</el-button>
      </el-form-item>
    </el-form>
    <el-table :data="list" style="width: 100%">
      <!-- <el-table-column  label="活动名称">邀新人 赚福利 </el-table-column>
      <el-table-column  label="用户名" prop="accountType"> </el-table-column> -->
      <el-table-column  label="真实姓名" prop="realName"> </el-table-column>
      <el-table-column  label="提现金额" prop="amount"> </el-table-column>
      <el-table-column  label="银行卡号" prop="account"> </el-table-column>
      <el-table-column  label="所属银行" prop="bankName"> </el-table-column>

      <el-table-column
        prop="status"
        label="审核状态"
        style="width: 180px"
        :filters="[
          { text: '未审核', value: '未审核' },
          { text: '已驳回', value: '已驳回' },
          { text: '已同意', value: '已同意' },
        ]"
        :filter-method="filterTag"
        filter-placement="bottom-end"
      >
        <template v-slot="{row}">
          <el-tag
            :type="
            row.status == 'ToAccount'
                ? 'success'
                : 'warning' && row.status === 'Reject'
                ? 'danger'
                : 'warning'
            "
            disable-transitions
          >
            {{ funcheck(row.status) }}
          </el-tag>
        </template>
      </el-table-column>
      <el-table-column prop="applyTime" label="提交时间"> </el-table-column>
      <el-table-column label="操作">
        <template v-slot="{row}">
        <el-button type="text" @click="hsubente(row)"
          >查看详细</el-button
        >
        </template>
      </el-table-column>
    </el-table>
       <el-pagination
        class="lyx"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page.sync="q.index"
        :page-size="2"
        layout="prev, pager, next, jumper"
      >
      </el-pagination>
  </div>
</template>

<script>
import {userwithdraw} from '@/api/roles'
import employeesConst from "@/constant/employees";
const hireTypeMapck = {};
employeesConst.hireaitemout.forEach((item) => {
  hireTypeMapck[item.status] = item.value;
});
export default {
  data() {
    return {
      formdata:{
        region:''
      },
        list:[],
        q:{
          index:1,
          size:10,
          status:null
        }
    };
  },
  created(){
    this.loadione()
  },
  methods: {
   async loadione(){
         const res = await userwithdraw(this.q)
        //  console.log(res.data);
        this.list = res.data.data
    },
    // 搜索
    search(){
     if (this.q.status == "") {
      this.q.status = null

      }
      this.q.status = this.formdata.region;
      this.loadione()
    },
    // 重置
    replacement(){
      this.q.index = 1
  this.q.status = null
   this.formdata.region = ''
      this.loadione()
    },
    // 查看详细
    hsubente(row){
    this.$router.push({
        path: "/home/message",
        query: { row },
      });
    },
         // 分页
    handleCurrentChange(index) {
      this.q.index = index;
      this.loadione();
    },
    handleSizeChange(size) {
      this.q.size = size;
      this.loadione();
    },
    filterTag(value, row) {
      return row.status === value;
    },
    funcheck(code){
      return hireTypeMapck[code];
    }
  },
};
</script>

<style scoped>
.acctive {
  background-color: #fff;
  padding-left: 30px;
  padding-top: 15px;
}
.chande{
  display: inline-block;
  background-color: #ff7144;
  color: #fff;
  border: 1px solid #ff7144;
  margin-left: 15px;
}
.aceater:hover {
  background-color: rgb(255, 248, 243);
  color: #ff7144;
  border: 1px solid rgb(255, 190, 132);
}
.aceater:focus {
  background-color: rgb(255, 248, 243);
  color: #ff7144;
  border: 1px solid rgb(255, 190, 132);
}
</style>
